package com.bdqn.t330.ch12file.servcie;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bdqn.t330.ch12file.entity.RightEntity;
import com.bdqn.t330.ch12file.mapper.RightMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class RightServiceImp extends ServiceImpl<RightMapper, RightEntity> implements RightService {

    @Resource
    RightMapper rightMapper;

    @Override
    public IPage<RightEntity> getListBiz(Page page, QueryWrapper queryWrapper) {
        return rightMapper.selectPage(page, queryWrapper);
    }

    @Override
    public int deleteRightService(String rightCode) {
        return rightMapper.deleteById(rightCode);
    }

    @Override
    public int addRightService(RightEntity rightEntity) {
        return rightMapper.insert(rightEntity);
    }

    @Override
    public int deleteByRightIdBiz(String rightCode) {
        return rightMapper.deleteByRightId(rightCode);
    }
}
